<template>
  <div>
    <div class="GuessyoulikeTitle">
      <div class="GuessyoulikeTitle-left">
        <i class="Vertical"></i>
        <span class="Guessyoulike-font">猜您喜欢</span>
      </div>
      <!-- <div class="GuessyoulikeTitle-right"></div> -->
      <a class="GuessyoulikeTitle-right" @click="change()">
        <span class="change-font">换一组</span>
        <i class="change-icom"></i>
      </a>
    </div>
    <!-- 下面猜你喜欢中的代码 -->
    <!-- 猜你喜欢中的外面大框 -->
    <div class="GuessyoulikeBox">
      <!-- 猜你喜欢中的里面大框 -->
      <div class="GuessyoulikeItem">
        <!-- 猜你喜欢中的里面打印大框 -->
        <div class="GuessyoulikeItem-body">
          <!-- 猜你喜欢中的里面打印小部分第一大框 -->
          <div
            class="GuessyoulikeItem-smartBox"
            v-for="(item, index) in goodsLikeArr"
            :key="index"
            @click="JumpFtn(item.gid)"
          >
            <img
              :src="item.g_picture"
              alt=""
              height="220"
              width="280"
              class="Guessyoulike-imgs"
            />

            <div class="like-crow-font-img"></div>
            <!-- <div class="thumbs-up-box">
              <div class="thumbs-up-img"></div>
              <span>2</span>
            </div> -->
            <div class="like-introdu-box">
              <h4>
                {{ item.g_name }}
              </h4>
            </div>
            <!-- 进度条 -->
            <!-- <div class="like-progress-box">
              <span class="like-progress-box-Item" style="width:30%"></span>
            </div> -->
            <Progress
              :percent="item.g_type"
              status="active"
              :stroke-color="['#108ee9', '#87d068']"
              style="margin-left: 20px;wdith:225px"
            />
            <!-- 框的底部框 -->
            <div class="GuessyoulikeItem-smartBox-foot">
              <ul class="GuessyoulikeItem-smartBox-foot-Item">
                <!-- 已达 -->
                <li class="like-Readed">
                  <p class="percentage">{{ item.g_type }}%</p>
                  <p class="like-Readed-font">已达</p>
                  <span class="Vertical-line"></span>
                </li>
                <!-- 已愁 -->
                <li class="like-Ready">
                  <p class="percentage2">￥{{ item.g_start_money }}</p>
                  <p class="like-Ready-font2">超值档位</p>
                  <span class="Vertical-line"></span>
                </li>
                <!-- 剩余时间 -->
                <li class="like-Remainimg-time">
                  <p class="percentage3">0%</p>
                  <p class="like-Remainimg-time-font">剩余时间</p>
                  <span class="Vertical-line"></span>
                </li>
              </ul>
            </div>
          </div>
          <!-- 第二个框 -->
          <!-- 猜你喜欢中的里面打印小部分大框 -->
          <!-- <div class="GuessyoulikeItem-smartBox">
            <a href="">
              <img
                src="https://img30.360buyimg.com/cf/jfs/t1/120711/39/2885/21369/5eca6d99Ecd137b34/52fb7855497c5e42.jpg"
                alt=""
                height="220"
                width="280"
                class="Guessyoulike-imgs"
              />
            </a>
            <div class="like-crow-font-img"></div> -->
          <!-- <div class="thumbs-up-box">
              <div class="thumbs-up-img"></div>
              <span>2</span>
            </div> -->
          <!-- <div class="like-introdu-box">
              <h4 title="三高患者福音—激光理疗手环Ⅱ">
               三高患者福音—激光理疗手环Ⅱ
              </h4>
            </div> -->
          <!-- 进度条 -->
          <!-- <div class="like-progress-box">
              <span class="like-progress-box-Item" style="width:30%"></span>
            </div> -->
          <!-- 框的底部框 -->
          <!-- <div class="GuessyoulikeItem-smartBox-foot">
              <ul class="GuessyoulikeItem-smartBox-foot-Item"> -->
          <!-- 已达 -->
          <!-- <li class="like-Readed">
                  <p class="like-percentage">0%</p>
                  <p class="like-Readed-font">已达</p>
                  <span class="Vertical-line"></span>
                </li> -->
          <!-- 已愁 -->
          <!-- <li class="like-Ready">
                  <p class="like-percentage2">0%</p>
                  <p class="like-Ready-font2">超值档位</p>
                  <span class="Vertical-line"></span>
                </li> -->
          <!-- 剩余时间 -->
          <!-- <li class="like-Remainimg-time">
                  <p class="like-percentage3">0%</p>
                  <p class="like-Remainimg-time-font">剩余时间</p>
                  <span class="Vertical-line"></span>
                </li>
              </ul>
            </div>
          </div> -->
          <!-- 第三个框 -->
          <!-- 猜你喜欢中的里面打印小部分大框 -->
          <!-- <div class="GuessyoulikeItem-smartBox">
            <a href="">
              <img
                src="https://img30.360buyimg.com/cf/jfs/t1/120711/39/2885/21369/5eca6d99Ecd137b34/52fb7855497c5e42.jpg"
                alt=""
                height="220"
                width="280"
                class="Guessyoulike-imgs"
              />
            </a>
            <div class="like-crow-font-img"></div> -->
          <!-- <div class="thumbs-up-box">
              <div class="thumbs-up-img"></div>
              <span>2</span>
            </div> -->
          <!-- <div class="like-introdu-box">
              <h4 title="雅瓷汝窑 温良恭俭让五君子杯">
               三高患者福音—激光理疗手环Ⅱ
              </h4>
            </div> -->
          <!-- 进度条 -->
          <!-- <div class="like-progress-box">
              <span class="like-progress-box-Item" style="width:30%"></span>
            </div> -->
          <!-- 框的底部框 -->
          <!-- <div class="GuessyoulikeItem-smartBox-foot">
              <ul class="GuessyoulikeItem-smartBox-foot-Item"> -->
          <!-- 已达 -->
          <!-- <li class="like-Readed">
                  <p class="like-percentage">0%</p>
                  <p class="like-Readed-font">已达</p>
                  <span class="Vertical-line"></span>
                </li> -->
          <!-- 已愁 -->
          <!-- <li class="like-Ready">
                  <p class="like-percentage2">0%</p>
                  <p class="like-Ready-font2">超值档位</p>
                  <span class="Vertical-line"></span>
                </li> -->
          <!-- 剩余时间 -->
          <!-- <li class="like-Remainimg-time">
                  <p class="like-percentage3">0%</p>
                  <p class="like-Remainimg-time-font">剩余时间</p>
                  <span class="Vertical-line"></span>
                </li>
              </ul>
            </div>
          </div> -->
          <!-- 第四各框 -->
          <!-- 猜你喜欢中的里面打印小部分大框 -->
          <!-- <div class="GuessyoulikeItem-smartBox">
            <a href="">
              <img
                src="https://img30.360buyimg.com/cf/jfs/t1/120711/39/2885/21369/5eca6d99Ecd137b34/52fb7855497c5e42.jpg"
                alt=""
                height="220"
                width="280"
                class="Guessyoulike-imgs"
              />
            </a>
            <div class="like-crow-font-img"></div> -->
          <!-- <div class="thumbs-up-box">
              <div class="thumbs-up-img"></div>
              <span>2</span>
            </div> -->
          <!-- <div class="like-introdu-box">
              <h4 title="雅瓷汝窑 温良恭俭让五君子杯">
               三高患者福音—激光理疗手环Ⅱ
              </h4>
            </div> -->
          <!-- 进度条 -->
          <!-- <div class="like-progress-box">
              <span class="like-progress-box-Item" style="width:30%"></span>
            </div> -->
          <!-- 框的底部框 -->
          <!-- <div class="GuessyoulikeItem-smartBox-foot">
              <ul class="GuessyoulikeItem-smartBox-foot-Item"> -->
          <!-- 已达 -->
          <!-- <li class="like-Readed">
                  <p class="like-percentage">0%</p>
                  <p class="like-Readed-font">已达</p>
                  <span class="Vertical-line"></span>
                </li> -->
          <!-- 已愁 -->
          <!-- <li class="like-Ready">
                  <p class="like-percentage2">0%</p>
                  <p class="like-Ready-font2">超值档位</p>
                  <span class="Vertical-line"></span>
                </li> -->
          <!-- 剩余时间 -->
          <!-- <li class="like-Remainimg-time">
                  <p class="like-percentage3">0%</p>
                  <p class="like-Remainimg-time-font">剩余时间</p>
                  <span class="Vertical-line"></span>
                </li>
              </ul>
            </div>
          </div> -->
        </div>
      </div>
    </div>
    <!-- <div class="GuessyoulikeBox">猜你喜欢中</div> -->
  </div>
</template>

<script>
import { Selectlikegoods } from "../../../../../server/allproject.js";
export default {
  data() {
    return {
      goodsLikeArr: [],
      progress: 0,
      progressArr: [],
    };
  },
  created() {
    Selectlikegoods().then((res) => {
      this.searchProduct();
    });
  },
  methods: {
    JumpFtn(e) {
      this.$router.push({
        path: "/front/detail",
        query: {
          gid: e,
        },
      });
    },
    change(){
       this.searchProduct();

    },
    //把页面一打开就渲染的东西封装函数
    searchProduct() {
      let that = this;
      Selectlikegoods().then((res) => {
        that.goodsLikeArr = res.data;

        for (var i = 0; i < that.goodsLikeArr.length; i++) {
          var sNum = that.goodsLikeArr[i].g_start_money;

          var eNum = that.goodsLikeArr[i].g_end_money;

          that.progressArr.push(parseInt((sNum / eNum) * 100));
          for (let j = 0; j < that.progressArr.length; j++) {

            //  this.goodsArr[i].g_type =
            // parseInt(this.progressArr[j]) > 100
            //   ? 100
            //   : parseInt(this.progressArr[j]);

            that.goodsLikeArr[i].g_type = parseInt(that.progressArr[j]>100 ? 100 :that.progressArr[j]);
          }
          // return isNaN(this.progress) ? 0 : this.progress
        }
      });
    },
////////////////////////
  

//////////




  },
};
</script>

<style scoped>
.GuessyoulikeTitle {
  width: 1200px;
  height: 26px;
  /* border:1px solid blue; */
  margin-top: 45px;
  /* background-color: red; */
}
.GuessyoulikeTitle-left {
  width: 130px;
  height: 24px;
  /* border:1px solid  red; */
}
.Vertical {
  display: block;
  width: 4px;
  height: 26px;
  background: #3ae0ab;
  float: left;
  margin-left: 10px;
}
.Guessyoulike-font {
  height: 24px;
  line-height: 24px;
  font-size: 24px;
  float: left;
  margin-left: 14px;
  color: #323232;
  font-weight: 700;
  margin-top: -1px;
}
/* 右边区域 */
.GuessyoulikeTitle-right {
  float: right;
  color: #a5a5a5;
  cursor: pointer;
  padding-right: 10px;
  margin-right: 58px;
  margin-top: -23px;
}
/* 点击换新的图标 */
.change-icom {
  float: right;
  width: 12px;
  height: 16px;
  background: url(https://static.360buyimg.com/finance/crowdfunding/list/3.0.0/css/i/change.png)
    0 3px no-repeat;
  margin-top: 4px;
  margin-right: -15px;
}
/* 换一组的文字 */
.change-font {
  margin-top: 5px;
  margin-right: -66px;
  float: right;
}

/* 分离开 */
/* 猜你喜欢中的代码 */
.GuessyoulikeBox {
  width: 1200px;
  height: 380px;
  /* border: 1px solid red; */
}
/* 猜你喜欢中的里面大框 */
.GuessyoulikeItem {
  width: 1300px;
  height: 380px;
  /* border: 1px solid seagreen; */
}
/* 猜你喜欢中的里面打印大框  */
.GuessyoulikeItem-body {
  width: 1300px;
  height: 380px;
  /* border: 1px solid royalblue; */
}
.GuessyoulikeItem-smartBox {
  float: left;
  width: 280px;
  height: 354px;
  background: #fff;
  box-shadow: 0 0 29px #ececec;
  transition: 6s;
  margin: 10px;
}
.GuessyoulikeItem-smartBox:hover .Guessyoulike-imgs {
  overflow: hidden;
  transform: scale(1.02, 1.02);
}
/* .GuessyoulikeItem-smartBox:hover .thumbs-up-box {
  display: block;
} */
.like-crow-font-img {
  margin-top: -3px;
  position: absolute;
  width: 75px;
  height: 75px;
  display: inline-block;
  background-position: 0 -241px;
  background-image: url(https://static.360buyimg.com/finance/crowdfunding/list/3.0.0/css/i/status-saba994faed.png);
  margin-left: -283px;
}
/* 点赞框 */
/* .thumbs-up-box {
  position: absolute;
  margin-left: 216px;
  margin-top: -211px;
  width: 54px;
  height: 26px;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  border-radius: 2px;
  line-height: 26px;
  display: none;
} */

/* 大拇指图片 */
/* .thumbs-up-img {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-left: 8px;
  margin-right: 5px;
  background-position: 0 -37px;
  background-image: url(https://static.360buyimg.com/finance/crowdfunding/list/3.0.0/css/i/cur-s4effb5dc05.png);
  background-repeat: no-repeat;
} */
/* 文字介绍框 */
.like-introdu-box {
  width: 240px;
  height: 20px;
  margin-left: -1px;
  margin-top: 14px;
  text-align: center;
  line-height: 20px;
  max-width: 250px;
  color: #323232;
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  font-family: "Microsoft Yahei";
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 进度条框 */
.like-progress-box {
  height: 8px;
  border-radius: 4px;
  background: #e6e6e6;
  overflow: hidden;
  margin-left: 20px;
  margin-top: 23px;
  width: 249px;
}
.like-progress-box-Item {
  display: block;
  height: 8px;
  background-image: url(https://static.360buyimg.com/finance/crowdfunding/list/3.0.0/css/i/status-saba994faed.png);
  background-repeat: no-repeat;
}
.GuessyoulikeItem-smartBox-foot {
  width: 250px;
  height: 60px;
  margin-left: 20px;
  margin-top: 5px;
}
.GuessyoulikeItem-smartBox-foot-Item {
  width: 250px;
  height: 36px;
}
/* 有写已达的字框 */
.like-Readed {
  position: relative;
  padding-left: 15px;
  float: left;
  width: 80px;
  height: 34px;
  position: relative;
  padding-left: 15px;
  margin-top: 12px;
}
/* 百分比 */
.like-percentage {
  font-size: 14px;
  color: #5e5e5e;
  line-height: 18px;
}
/* 有写已达的字 */
.like-Readed-font {
  color: #a5a5a5;
}
/* 竖线 */
.Vertical-line {
  position: absolute;
  right: 0;
  top: 0;
  width: 1px;
  height: 36px;
  background: #e7e7e7;
}
/* 有写已愁的的字框 */
.like-Ready {
  position: relative;
  padding-left: 15px;
  float: left;
  width: 80px;
  height: 34px;
  position: relative;
  padding-left: 15px;
  margin-top: 12px;
}
/* 百分比 */
.like-percentage2 {
  font-size: 14px;
  color: #5e5e5e;
  line-height: 18px;
}
/* 有写已达的字 */
.like-Ready-font2 {
  color: #a5a5a5;
}
/* 有写剩余时间的框 */
.like-Remainimg-time {
  position: relative;
  padding-left: 15px;
  float: left;
  width: 80px;
  height: 34px;
  position: relative;
  padding-left: 15px;
  margin-top: 12px;
}
/* 百分比 */
.like-percentage3 {
  font-size: 14px;
  color: #5e5e5e;
  line-height: 18px;
}
/* 有写剩余时间的字 */
.like-Remainimg-time-font {
  color: #a5a5a5;
}
/* 分页按钮 */
.pageBtn {
  margin-left: 1000px;
}
</style>
